import axios from 'axios'
import { CHANGE_LOGIN, CHANGE_LOGOUT } from './actionTypes'
const changeLogin = () => {
    return {
        type: CHANGE_LOGIN,
        value: true
    }
}
export const logout = () => ({
    type: CHANGE_LOGOUT,
    vlaue: false
})
export const login = (accout, password) => {
    return (dispatch) => {
        axios.get('/api/login.json?accout=' + accout + '&password=' + password).then((res) => {
            const result = res.data.data
            if (result) {
                dispatch(changeLogin())
            } else {
                alert('登录失败')
            }
            // console.log(result);
        })
    }
}